-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
networking tests: fix ssh auth, clean up code #1060
Conversation
- Fix SSH auth using password. Paramiko can get confused when using password authentication while having SSH keys in the SSH agent. In case the test suite is being run using password based authentication, the options `allow_agent=False` and `look_for_key=False` prevent paramiko from trying to get keys from the SSH agent, allowing password based authentication to proceed without error. - Clean up duplicated fixture `vlan_id` and `vlan_nic`. These pytest fixtures were copy-and-pasted into several places, so to simplify the code they are consolidated in a single place where other network fixtures can be kept in the future as well. Signed-off-by: Moritz Röhrich <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run a test on all changed test files especially VM having a test with jumphost (use fixture vm_shell_from_host
) to make sure the allow_agent
will not break any exisiting tests.
# prevents paramiko from getting confused by ssh keys in the ssh | ||
# agent: | ||
if self.password and not self.pkey: | ||
kws.update(dict(allow_agent=False, look_for_keys=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implement will implicit overwrite allow_agent
and look_for_keys
when call the method as
login("IP", allow_agent=True, look_for_keys=True)
So please update the method signature to add parameters allow_agent
and look_for_keys
with default False
and merge them into kws
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok done, but calling login("IP", allow_agent=True, look_for_keys=True)
makes no sense because the authentication will still fail if they want to use password authentication but have an SSH key in their ssh agent.
Keep in mind that some people have an SSH key in their agent that has nothing to do with these tests.
Make ssh parameters `allow_agent` and `look_for_keys` default to `False`, but let them be overridden on method call if necessary. Signed-off-by: Moritz Röhrich <[email protected]>
Works fine for me:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general LGTM
Fix SSH auth using password. Paramiko can get confused when using password authentication while having SSH keys in the SSH agent. In case the test suite is being run using password based authentication, the options
allow_agent=False
andlook_for_key=False
prevent paramiko from trying to get keys from the SSH agent, allowing password based authentication to proceed without error.Clean up duplicated fixture
vlan_id
andvlan_nic
. These pytest fixtures were copy-and-pasted into several places, so to simplify the code they are consolidated in a single place where other network fixtures can be kept in the future as well.